<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
    <meta content='' name='description'>
    <meta content='Nils Nordman' name='author'>
    <link href='/images/howl.png' rel='shortcut icon'>
    <title>Howl :: Spec - howl.ui.StyledText</title>
    <link href="/stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/syntax.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/howl.css" media="screen" rel="stylesheet" type="text/css" />
    <link href='//fonts.googleapis.com/css?family=Josefin+Slab' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:700' rel='stylesheet' type='text/css'>
  </head>
  <body class='doc doc_spec doc_spec_ui doc_spec_ui_styled_text_spec'>
    <div class='container'>
      <div class='masthead'>
        <ul class='nav nav-pills'>
          <li>
            <a href='/'>
              <span class='glyphicon glyphicon-home'></span>
              Home
            </a>
          </li>
          <li>
            <a href='/doc/'>
              <span class='glyphicon glyphicon-book'></span>
              Documentation
            </a>
          </li>
          <li>
            <a href='/blog/'>
              <span class='glyphicon glyphicon-bullhorn'></span>
              Blog
            </a>
          </li>
          <li>
            <a href='/contact.html'>
              <span class='glyphicon glyphicon-inbox'></span>
              Contact
            </a>
          </li>
        </ul>
      </div>
      <ol class="breadcrumb"><li><a href="/">Home</a></li><li><a href='../../'>Howl 0.3 Documentation</a></li><li>Spec</li><li>Ui</li><li>Spec - howl.ui.StyledText</li></ol>
      <div class="spec-group spec-group-1">&#x000A;&#x000A;<h1 id="howl.ui.styledtext">howl.ui.StyledText</h1>&#x000A;&#x000A;<h4 id="has-a-type-of-styledtext">has a type of StyledText</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'StyledText'</span><span class="p">,</span><span class="w"> </span><span class="n">typeof</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{})</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="responds-to-tostring-correctly">responds to tostring correctly</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'my_text'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'my_text'</span><span class="p">,</span><span class="w"> </span><span class="p">{})</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="responds-to-the-length-operator-(#)">responds to the length operator (#)</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="o">#</span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'my_text'</span><span class="p">,</span><span class="w"> </span><span class="p">{})</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="can-be-concatenated-with-strings">can be concatenated with strings</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">st</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{})</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'foobar'</span><span class="p">,</span><span class="w"> </span><span class="n">st</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'bar'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'barfoo'</span><span class="p">,</span><span class="w"> </span><span class="s1">'bar'</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="n">st</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="can-be-concatenated-with-styledtext-to-produce-styledtext">can be concatenated with StyledText to produce StyledText</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">st1</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foö'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="p">})</span><span class="w">&#x000A;</span><span class="n">st2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'1234'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="p">})</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foö1234'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">9</span><span class="p">}),</span><span class="w"> </span><span class="n">st1</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="n">st2</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="defers-to-the-string-meta-table">defers to the string meta table</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">st</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'xåäö'</span><span class="p">,</span><span class="w"> </span><span class="p">{})</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'x'</span><span class="p">,</span><span class="w"> </span><span class="n">st</span><span class="o">\</span><span class="n">sub</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'å'</span><span class="p">,</span><span class="w"> </span><span class="n">st</span><span class="o">\</span><span class="n">usub</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="n">st</span><span class="p">.</span><span class="n">ulen</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="is-equal-to-other-styledtext-instances-with-the-same-values">is equal to other StyledText instances with the same values</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{}),</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{})</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">}),</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">})</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">not_equal</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'fo1'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">}),</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">})</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">not_equal</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">}),</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'number'</span><span class="p">,</span><span class="w"> </span><span class="mi">3</span><span class="p">})</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(for_table)</span></h3>&#x000A;&#x000A;<h4 id="returns-a-table-containing-rows-padded-and-newline-terminated">returns a table containing rows padded and newline terminated</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'one  \ntwo  \nthree\n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="s1">'one'</span><span class="p">,</span><span class="w"> </span><span class="s1">'two'</span><span class="p">,</span><span class="w"> </span><span class="s1">'three'</span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="converts-numbers-to-string">converts numbers to string</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">33</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">includes</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tbl</span><span class="p">),</span><span class="w"> </span><span class="s1">'33'</span></code></pre>&#x000A;&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when items contain chunks)</span></h3>&#x000A;&#x000A;<h4 id="pads-chunks-correctly">pads chunks correctly</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Buffer</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">buf</span><span class="p">.</span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">' twë '</span><span class="w">&#x000A;</span><span class="n">chunk</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">buf</span><span class="o">\</span><span class="n">chunk</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="w">&#x000A;</span><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="s1">'onë'</span><span class="p">,</span><span class="w"> </span><span class="n">chunk</span><span class="p">,</span><span class="w"> </span><span class="s1">'three'</span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'onë  \ntwë  \nthree\n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="n">tbl</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="preserves-chunks-styles">preserves chunks styles</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">buf</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">howl</span><span class="p">.</span><span class="n">ui</span><span class="p">.</span><span class="nc">ActionBuffer</span><span class="o">!</span><span class="w">&#x000A;</span><span class="n">buf</span><span class="o">\</span><span class="n">append</span><span class="w"> </span><span class="s1">'hëllo'</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="w">&#x000A;</span><span class="n">chunk</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">buf</span><span class="o">\</span><span class="n">chunk</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">5</span><span class="w">&#x000A;&#x000A;</span><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="n">chunk</span><span class="p">,</span><span class="w"> </span><span class="n">chunk</span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'hëllo \nhëllo \n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="n">tbl</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">styles</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="mi">9</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">15</span><span class="p">}</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when column style is provided)</span></h3>&#x000A;&#x000A;<h4 id="applies-column-style-to-text-and-padding">applies column style to text and padding</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'one'</span><span class="p">,</span><span class="w"> </span><span class="s1">'twooo'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{</span><span class="ss">style:</span><span class="w"> </span><span class="s1">'string'</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">text</span><span class="p">,</span><span class="w"> </span><span class="s1">'one  \ntwooo\n'</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">styles</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">6</span><span class="p">,</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">12</span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="preserves-style-for-styledtext-objects">preserves style for StyledText objects</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="s1">'one'</span><span class="p">,</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">(</span><span class="s1">'two'</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">}),</span><span class="w"> </span><span class="s1">'three'</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="w"> </span><span class="ss">style:</span><span class="w"> </span><span class="s1">'comment'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">styles</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'comment'</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w"> </span><span class="s1">'comment'</span><span class="p">,</span><span class="w"> </span><span class="mi">6</span><span class="p">,</span><span class="w"> </span><span class="mi">7</span><span class="p">,</span><span class="w"> </span><span class="s1">'string'</span><span class="p">,</span><span class="w"> </span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s1">'comment'</span><span class="p">,</span><span class="w"> </span><span class="mi">12</span><span class="p">,</span><span class="w"> </span><span class="mi">13</span><span class="p">,</span><span class="w"> </span><span class="s1">'comment'</span><span class="p">,</span><span class="w"> </span><span class="mi">18</span><span class="p">}</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when a header is provided)</span></h3>&#x000A;&#x000A;<h4 id="includes-header-row">includes header row</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Header\none   \n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'one'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{</span><span class="ss">header:</span><span class="w"> </span><span class="s1">'Header'</span><span class="p">}}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="pads-header">pads header</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Heád      \nfirst item\n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'first item'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{</span><span class="ss">header:</span><span class="w"> </span><span class="s1">'Heád'</span><span class="p">}}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="styles-headers-with-header_list,-including-padding">styles headers with header_list, including padding</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">tbl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'one-long-column'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{</span><span class="ss">header:</span><span class="w"> </span><span class="s1">'Head'</span><span class="p">}</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">tbl</span><span class="p">.</span><span class="n">styles</span><span class="p">,</span><span class="w"> </span><span class="p">{</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s1">'list_header'</span><span class="p">,</span><span class="w"> </span><span class="mi">16</span><span class="p">}</span></code></pre>&#x000A;&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when multiple columns are provided)</span></h3>&#x000A;&#x000A;<h4 id="returns-a-table-containing-multi-columns-rows">returns a table containing multi columns rows</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'oná   first \ntwo   second\nthree third \n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="s1">'oná'</span><span class="p">,</span><span class="w"> </span><span class="s1">'first'</span><span class="p">}</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="s1">'two'</span><span class="p">,</span><span class="w"> </span><span class="s1">'second'</span><span class="p">}</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="s1">'three'</span><span class="p">,</span><span class="w"> </span><span class="s1">'third'</span><span class="p">}</span><span class="w">&#x000A;</span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="columns-can-each-have-a-header">columns can each have a header</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'Head1 Head2\none   two  \n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{</span><span class="s1">'one'</span><span class="p">,</span><span class="w"> </span><span class="s1">'two'</span><span class="p">}</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{</span><span class="ss">header:</span><span class="w"> </span><span class="s1">'Head1'</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="ss">header:</span><span class="w"> </span><span class="s1">'Head2'</span><span class="p">}</span><span class="w"> </span><span class="p">}</span></code></pre>&#x000A;&#x000A;&#x000A;<h4 id="displays-nothing-for-nil-items">displays nothing for nil items</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><code><span class="n">assert</span><span class="p">.</span><span class="n">equal</span><span class="w"> </span><span class="s1">'one   a  \n      two\nthree    \n'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="w"> </span><span class="nc">StyledText</span><span class="p">.</span><span class="n">for_table</span><span class="w"> </span><span class="p">{</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="s1">'one'</span><span class="p">,</span><span class="w"> </span><span class="s1">'a'</span><span class="p">}</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="kc">nil</span><span class="p">,</span><span class="w"> </span><span class="s1">'two'</span><span class="p">}</span><span class="w">&#x000A;  </span><span class="p">{</span><span class="s1">'three'</span><span class="p">,</span><span class="w"> </span><span class="kc">nil</span><span class="p">}</span><span class="w">&#x000A;</span><span class="p">},</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">{},</span><span class="w"> </span><span class="p">{}</span><span class="w"> </span><span class="p">}</span></code></pre>&#x000A;&#x000A;</div>&#x000A;</div>&#x000A;</div>
      <div class='footer text-muted'>
        <a href='/'>
          <img width="50" height="50" class="footer-logo" src="/images/howl.png" />
        </a>
        <div class='footer-follow'>
          <p>
            <a class='twitter-follow-button' data-lang='en' data-show-count='false' href='https://twitter.com/howleditor' rel='me'>
              Follow @howleditor
            </a>
          </p>
          <p>
            <a class='twitter-share-button' data-count='none' data-hashtags='howleditor' data-lang='en' data-text='The Howl Editor, a general purpose, light-weight customizable editor.' data-url='http://howl.io' href='https://twitter.com/share'>
              Tweet
            </a>
          </p>
        </div>
        <div class='footer-blurb'>
          <div>The Howl editor.</div>
          <div>
            Copyright 2012-2015
            <a class='alert-link' href='https://github.com/nilnor/howl/contributors'>
              The Howl Developers.
            </a>
          </div>
        </div>
      </div>
    </div>
    <script>
      <!-- / GA -->
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-45283282-1', 'howl.io');
      ga('send', 'pageview');
      <!-- / Twitter -->
      !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
      if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
      js.src="//platform.twitter.com/widgets.js";
      fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
    </script>
  </body>
</html>
